Check Shortcut Last Run Time
(
75
actions, 51 KB)
0 Get Dictionary from
[Shortcut Input]
➔ inputDict
»
1
6
66
69
71
1 Text
➔ keyPath
»
2
4
67
72
My Apple Shortcuts.shortcutLastRunTime.
[0 inputDict
.shortcutName
]
2 DataJar > CheckIfValueExistsIntent »
keyPath
:
[1 keyPath]
3 If
[2 Value Exists
as Boolean
]
is true
NumberValue
:
ConditionalActionString
:
No
4 DataJar > GetValueIntent »
keyPath
:
[1 keyPath]
5 Get Dates from
[4 Value]
»
9
19
25
31
37
43
49
55
6 Get Dictionary Value for
checkInterval
in
[0 inputDict]
»
7 Change
[6 Dictionary Value]
to
lowercase
»
8
14
8 If
[7 Updated Text]
is
today
9 If
[5 Dates]
is today
Duration
:
"" sec
10 Otherwise
11 Set Variable
runShortcut?
to
[CurrentDate]
12 End If
13 Otherwise
14 Split Text
[7 Updated Text]
by
Spaces
»
15
17
15 Get First Item from List
[14 Split Text]
➔ number
»
16 Get Numbers from
[15 number]
»
19
25
31
37
43
49
55
17 Get
Last Item
from List
[14 Split Text]
➔ unit
»
18
24
30
36
42
48
54
18 If
[17 unit]
contains
second
19 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
sec
20 Otherwise
21 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
22 End If
23 End If
24 If
[17 unit]
contains
minute
25 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
min
26 Otherwise
27 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
28 End If
29 End If
30 If
[17 unit]
contains
hour
31 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
hr
32 Otherwise
33 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
34 End If
35 End If
36 If
[17 unit]
contains
day
37 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
days
38 Otherwise
39 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
40 End If
41 End If
42 If
[17 unit]
contains
week
43 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
weeks
44 Otherwise
45 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
46 End If
47 End If
48 If
[17 unit]
contains
month
49 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
months
50 Otherwise
51 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
52 End If
53 End If
54 If
[17 unit]
contains
year
55 If
[5 Dates]
is in the last
NumberValue
1
Duration
[16 Numbers]
years
56 Otherwise
57 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
58 End If
59 End If
60 End If ▵
13
61 Otherwise ▵
3
62 Set Variable
runShortcut?
to
[CurrentDate
{"Date Style":"Medium","WFISO8601IncludeTime":false,"Time Style":"Short"}
]
63 End If
64 If
[runShortcut?]
has any value
65 DataJar > GetValueIntent »
66
71
keyPath
:
My Apple Shortcuts.mustRun
66 If
[65 Value
’s Name
]
contains
[0 inputDict
.shortcutName
]
67 DataJar > SetValueIntent
overwriteStrategy
:
alwaysAllow
keyPath
:
[1 keyPath]
valueConversionMode
:
text
values
:
[runShortcut?
as Date
]
68 End If
69 Text »
[0 inputDict
.shortcutName
]
- Kernel
70 Run Shortcut
[69 Text]
Workflow
:
[69 Text]
71 If
[65 Value
’s Name
]
does not contain
[0 inputDict
.shortcutName
]
72 DataJar > SetValueIntent
overwriteStrategy
:
alwaysAllow
keyPath
:
[1 keyPath]
valueConversionMode
:
text
values
:
[runShortcut?
as Date
]
73 End If
74 End If ▵
64